﻿using System;
using Coolite.Ext.Web;
using Pap.Web.Modules.Loan.ViewModel;
using Pap.Web.Utils;

namespace Pap.Web.Modules.Loan.Views
{
    /// <summary>
    /// 
    /// </summary>
    public partial class Ricepte : BasePage<RecipteViewModel>
    {
        #region [ QueryString ]

        /// <summary>
        /// Gets the name of the customer.
        /// </summary>
        /// <value>
        /// The name of the customer.
        /// </value>
        string CustomerName
        {
            get { return Request.QueryString["CustomerName"]; }
        }

        /// <summary>
        /// Gets the loan number.
        /// </summary>
        string LoanNumber
        {
            get { return Request.QueryString["LoanNumber"]; }
        }

        /// <summary>
        /// Gets the receipte number.
        /// </summary>
        string ReceipteNumber
        {
            get { return Request.QueryString["ReceipteNumber"]; }
        }
        /// <summary>
        /// Gets the receipt date.
        /// </summary>
        string ReceiptDate
        {
            get { return Request["ReceiptDate"]; }
        }

        /// <summary>
        /// Gets the receipt amount.
        /// </summary>
        string ReceiptAmount
        {
            get { return Request.QueryString["ReceiptAmount"]; }
        }

        #endregion

        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack && !Ext.IsAjaxRequest)
            {
                txtCustomerName.Text = CustomerName;
                txtRecipteNumber.Text = ReceipteNumber;
                txtLoanNumber.Text = LoanNumber;
                txtReceiptDate.Text = ReceiptDate;
                txtReceiptAmount.Text = ReceiptAmount;
                image.ImageUrl = ResolveClientUrl((this.ViewModel.GetRecipteImageUrl() + "&Width=400&Height=300"));
            }
        }
    }
}
